﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Supermarket.Bll;

namespace Supermarket.Web.UserControls
{
    public partial class UserControlBuyProduct : System.Web.UI.UserControl
    {
        public string ProductId { get; set; }
        public string ProductName { get; set; }
        public string ProductPrice { get; set; }
        public string Code { get; set; }
        
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Page_PreRender(object sender, EventArgs e)
        {
            hfId.Value = ProductId;
            LabelProductName.Text = ProductName;
            LabelProductPrice.Text = ProductPrice;
            LabelMeasureCode.Text = Code;
        }

        protected void ButtonCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/CashierPages/Sales.aspx");
        }

        protected void ButtonBuy_Click(object sender, EventArgs e)
        {

            Response.Redirect(String.Format("~/CashierPages/AddToCart.aspx?productId={0}&quantity={1}", hfId.Value, TextBoxQuantity.Text));
        }
    }
}